package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016100200643726";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCbCG73P0ZY4vh30RIsLDJFHjgrJHPwS+eHgUbmKr41PW2wBm1aYlYYRRJuip3iEzb/XONVr6KlJ2X5koL60EoMWIREnqzB5scb4hiZWMo8hA2adcCf1jLbMG89hu69uurltv/Lihw7ILZz6Q3GY2tHT5rJ66PEeuTpqYR51nvi/H2FNdOhrGEDRVU4LtrfrHTBbmvtnzU86y2EwbjjSML57TOzquZ+Uh2oy02Z1AnyqusCRLVTvpoV5+Zt62YBBYTL1fMSeUOLZWln5dbCk7fXSO0KLSkw1NkJJf/Wlx2ZiPbFSfm9tXh4PcDdydM5CjzpPaRkFAoe8fh4kgEHRgrVAgMBAAECggEADph6qfhhDRlBPzaFuXbnvK4dp6Ik8CiVQaKgJCc+BREldH8GaI39gQdvtsyCFLiuYthB5t1EOLw+04JBpo9ZiVQED9nIdfDeKffdTQKY952PEk2ntuSZoR0sO+SqMV6ZosrZxjXYdpCb3MnCLD1L6kjKT9xJbMQNLRpyiG3y9+mbZ3YXQySAlxUKePjtx+fKec69/z8ZFhWcLS+BQx2QotmH9PS1lVXuwOWqPX17FuXYiTyU++zuNSuTfF61Li12UVlA4w1ZKbFNIX3CPmmvU+NVgqO8HyeX0wWAoCkUBhCHuwZhqf8l96nRLNsx7Wc0AiLo82XdXIE1MipyJdNuwQKBgQDtkEdR8MQFL0LSxqvXZzH7q3H9mL92nN49HJhnPBYJWJpXu0M01L5EvYBN8cyZoNZFki5Ht2uUZAxUrfSLblK6XuTh0otkLcU81CwZKxiNRCSVoBMjGwzaMFlFTr2DdDK5IEBs3sI1zLbGl9FzDKXNGstBJ//hk5Qtl0REBMjujQKBgQCnEICw8JCTHI0w9FEG69dlr0ldElwfAF0sCb2sKTJnS24gfk+GGEu7bQ9Ji6klnrdghImuZg647pwPjZYIQm2QI2/v9hC3UzvQhFZBhri/9d0Ac0LRxPfrJ5PmhnOcAcwqvkJdTnHPSoewjqWxY1zTqVDRVtkgZZX73ZWWfqW/aQKBgEXjPBgPDJu5257Gc6da5Il1VoOUfD8YxwiTcQJt2s3FEyLcJFlWfOMcHLLRf69ycZbl+ld+zldJV5dR1a9vNUc+w3brybYfAPd0M8TzuLVWZqzd+sNJIe7OanTJRVd2x7VOl6VvoxLQtrSV1ThTcDN2vnTcn5ptIBqJdbvM7I/BAoGAKPxFdiMudMjWYqItlrMZPtsH9otgikJ+mSUyoR/iO7EnrVUPkWg4fBy/WV2n+5C6kDUzydND3V68bpxfqFsTof7voUEOzMrgq8EroBu7C2z38PpV9DyMTeaBxFZL2oQeYIYYpeduyFoSe+AjCifESDELoK/byLTjXMz5u9gKNbECgYAG1a/qAyPHm3ldiU1mhowZwkfB59v84Y8mRD03GpKslrMtZB6wH4aGiY3Bq/CSIpW3rFLrH1MbPUOd4jiRNRmJYqluYjbXAX6Mg6ZwbvfYkegP+SmTYKIojbRUn5+3/wdZWzdFKx41lQEs6Isj8YiGgog72NvB1HHQPBMhlyewrw==";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmwhu9z9GWOL4d9ESLCwyRR44KyRz8Evnh4FG5iq+NT1tsAZtWmJWGEUSboqd4hM2/1zjVa+ipSdl+ZKC+tBKDFiERJ6swebHG+IYmVjKPIQNmnXAn9Yy2zBvPYbuvbrq5bb/y4ocOyC2c+kNxmNrR0+ayeujxHrk6amEedZ74vx9hTXToaxhA0VVOC7a36x0wW5r7Z81POsthMG440jC+e0zs6rmflIdqMtNmdQJ8qrrAkS1U76aFefmbetmAQWEy9XzEnlDi2VpZ+XWwpO310jtCi0pMNTZCSX/1pcdmYj2xUn5vbV4eD3A3cnTOQo86T2kZBQKHvH4eJIBB0YK1QIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:/easy_buy/SuccessDeal.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

